package com.poems.util;

import java.util.Map;

import com.xit.poems.dto.FiveInformation;
import com.xit.poems.format.FiveEightPoemsFormat;
import com.xit.poems.format.FivePoemsFormat;

public class DetectFiveEightTonesIsPerfect {
	/**
	 * 
	 * @param poems
	 * @return
	 */
	public FiveInformation FiveClzyTonesIsPerfect(String poems){	
		DetectFiveEightRhymeAndTones detect = new DetectFiveEightRhymeAndTones();	
		DetectFiveCharacterQuatrain de = new DetectFiveCharacterQuatrain();
			String[] poemsFormat= detect.Clzy(poems);
			int i = de.detect(poemsFormat);
			FiveEightPoemsFormat fef = new FiveEightPoemsFormat();
			Map<Integer,Object> error = null;
			FiveInformation fi = new FiveInformation();
			switch (i) {
			case 1: error = fef.fiveEightBase(poemsFormat);fi.setId(1);break;
			case 2: error = fef.fiveEightStartBySecond(poemsFormat);fi.setId(2); break;
			case 3: error = fef.fiveEightStartByThird(poemsFormat); fi.setId(3);break;
			case 4: error = fef.fiveEightStartByFour(poemsFormat);fi.setId(4);break;
			default:break;
			}
			fi.setId(i);
			fi.setPoemsFormat(poemsFormat);
			fi.setMap(error);
			return fi;
	}
	
	
	
	/**
	 * 
	 * @param poems
	 * @return
	 */
	public FiveInformation FivePsyTonesIsPerfect(String poems){	
		DetectFiveEightRhymeAndTones detect = new DetectFiveEightRhymeAndTones();	
		DetectFiveCharacterQuatrain de = new DetectFiveCharacterQuatrain();
			String[] poemsFormat= detect.Psy(poems);
			int i = de.detect(poemsFormat);
			FiveEightPoemsFormat fef = new FiveEightPoemsFormat();
			Map<Integer,Object> error = null;
			FiveInformation fi = new FiveInformation();
			switch (i) {
			case 1: error = fef.fiveEightBase(poemsFormat);fi.setId(1);break;
			case 2: error = fef.fiveEightStartBySecond(poemsFormat);fi.setId(2); break;
			case 3: error = fef.fiveEightStartByThird(poemsFormat); fi.setId(3);break;
			case 4: error = fef.fiveEightStartByFour(poemsFormat);fi.setId(4);break;
			default:break;
			}
			fi.setId(i);
			fi.setPoemsFormat(poemsFormat);
			fi.setMap(error);
			return fi;
	}
	/**
	 * 
	 * @param poems
	 * @return
	 */
	public FiveInformation FiveZhxyTonesIsPerfect(String poems){	
		DetectFiveEightRhymeAndTones detect = new DetectFiveEightRhymeAndTones();	
		DetectFiveCharacterQuatrain de = new DetectFiveCharacterQuatrain();
			String[] poemsFormat= detect.Zhxy(poems);
			int i = de.detect(poemsFormat);
			FiveEightPoemsFormat fef = new FiveEightPoemsFormat();
			Map<Integer,Object> error = null;
			FiveInformation fi = new FiveInformation();
			switch (i) {
			case 1: error = fef.fiveEightBase(poemsFormat);fi.setId(1);break;
			case 2: error = fef.fiveEightStartBySecond(poemsFormat);fi.setId(2); break;
			case 3: error = fef.fiveEightStartByThird(poemsFormat); fi.setId(3);break;
			case 4: error = fef.fiveEightStartByFour(poemsFormat);fi.setId(4);break;
			default:break;
			}
			fi.setId(i);
			fi.setPoemsFormat(poemsFormat);
			fi.setMap(error);
			return fi;
	}
}
